package com.zxy;

import java.util.Scanner;

public class demo03 {
    public static void main(String[] args) {
        //定义一个数组来接收六个分数
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        //循环打出六个分数并接收到数组中
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请评委打分");
            int score = sc.nextInt();
            if (score >= 0 && score <= 100) {
                arr[i] = score;
            } else {
                System.out.println("您输入的分数有误，请重新输入");
                i--;
            }
        }
        int max = arr[0], min = arr[0], sum = 0;
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
            sum += arr[i];
        }
        System.out.println("最终分数为：" + ((sum - max - min) / (arr.length - 2)));
    }
}
